The Generalized Intensional Transformation for Implementing Lazy Functional Languages
نویسندگان
چکیده
The intensional transformation is a promising technique for implementing lazy functional languages based on a demand-driven execution model. Despite its theoretical elegance and its simple and efficient execution model, the intensional transformation suffered, until now, from two main drawbacks: it could only be applied to programs that manipulate primitive data-types and it could only compile a simple (and rather restricted) class of higher-order functions. In this paper we remedy the above two deficiencies, obtaining a transformation algorithm that is applicable to mainstream lazy functional languages. The proposed transformation initially uses defunctionalization in order to eliminate higher-order functions from the source program. The original intensional transformation is then extended in order to apply to the target first-order language with user-defined data types that resulted from the defunctionalization. It is demonstrated that the proposed technique can be used to compile a relatively large subset of Haskell into portable C code whose performance is comparable to existing mainstream implementations.
منابع مشابه
The Intensional Transformation for Functional Languages with User-Defined Data Types
We extend the intensional transformation [6, 4] so as to apply to first-order lazy functional languages with user-defined data types. Since higher-order functional programs can be translated to first-order ones with the use of data types [3], the proposed approach can also be used to transform fully higher-order lazy functional programs.
متن کاملEfficient Intensional Implementation for Lazy Functional Languages
The intensional transformation is a technique that can be used in order to eliminate higher-order functions from a functional program by introducing appropriate context manipulation operators. The transformation can be applied to a significant class of higher-order programs and results in equivalent zero-order intensional programs that can be executed in a simple demand-driven way. Despite its ...
متن کاملIntensional Investigations
This thesis is about the theory and practice of intensional semantics. Traditional denotational models of programming languages are usually extensional in that they concern themselves only with input/output properties of programs. The meaning of a program is typically taken to be a function from input to output containing no information about the way that function computes its result. In an int...
متن کاملHigher-Order Functional Languages and Intensional Logic
In this paper we demonstrate that a broad class of higher-order functional programs can be transformed into semantically equivalent multidimensional intensional programs that contain only nullary variable definitions. The proposed algorithm systematically eliminates userdefined functions from the source program, by appropriately introducing context-manipulation (i.e., intensional) operators. Th...
متن کاملThe Implementation and Efficiency of Arrays in Clean 1.1
We present a new approach to implementing arrays in a pure lazy functional programming language. The arrays can be updated destructively by using uniqueness typing, and the elements can be unboxed. We describe the implementation of these arrays in the functional programming language Clean 1.1. The performance of two sorting algorithms and a fast fourier transformation written in Clean using arr...
متن کامل